home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / domacnost a kancelar / avedesk / AveDesk13.exe / Effects / MoveItIn.effectlet < prev    next >
Extensible Markup Language  |  2005-10-22  |  5KB  |  228 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <effectlet>
  3.     <info>
  4.         <name>MoveItIn Effect Script</name>
  5.         <author>Dreadnaut</author>
  6.         <notes><![CDATA[ For bugs or anything else, contact me at dreadnaut@despammed.com ]]></notes>
  7.         <version>0.0.5</version>
  8.     </info>
  9.     <settings>
  10.         <param name="Debug" type="Boolean" defval="False"/>
  11.     </settings>
  12.  
  13.     <preferences>
  14.  
  15.     <preference name="EntranceSide" type="range" defval="0" min="0" max="8">
  16.     Select the side from which the desklet will move in
  17.  
  18.     0 - Right side
  19.     1 - Bottom side
  20.     2 - Left side
  21.     3 - Top side
  22.     4 - Top/Right corner
  23.     5 - Top/Left corner
  24.     6 - Bottom/Right corner
  25.     7 - Bottom/Left corner
  26.     8 - Random !
  27.  
  28.     </preference>
  29.  
  30.     <preference name="screen_Width" type="range" defval="1024" min="800" max="1600">
  31.     Your horizontal screen resolution
  32.         </preference>
  33.     <preference name="screen_Height" type="range" defval="768" min="600" max="1200">
  34.     Your vertical screen resolution
  35.         </preference>
  36.  
  37.     <preference name="Smoothness" type="range" defval="75" min="0" max="100">
  38.     Sets the smoothness of the animation
  39.         </preference>
  40.     <preference name="Speed" type="range"   defval="5" min="1" max="9">
  41.     Sets the speed of the slide effect
  42.         </preference>
  43.  
  44.     </preferences>
  45.  
  46.     <images>
  47.     </images>
  48.  
  49.     <script engine="vbScript"><![CDATA[
  50.  
  51.     Dim InitialTop, InitialLeft
  52.     Dim FinalTop, FinalLeft
  53.     Dim HMov, VMov, Step
  54.     Dim TickRate
  55.     Dim State
  56.     Dim PrefChange
  57.     Dim mySide
  58.  
  59.     'These routines are the optional ones called by the framework
  60.     Sub OnCreate()
  61.     'Init
  62.     FinalTop = Desklet.top
  63.     FinalLeft = Desklet.left
  64.  
  65.     'Default preferences
  66.     Side = 0
  67.     Smoothness = 75
  68.     Speed = 5
  69.  
  70.         'And Reading overwrites them with some previous user changes
  71.         Preferences.ReadAll()
  72.     Evaluate()
  73.     Reset()
  74.     End Sub
  75.  
  76.     Sub OnMouseOn()
  77.     End Sub
  78.  
  79.     Sub OnMouseout()
  80.     End Sub
  81.  
  82.     'Function OnBeforeDraw(IsMouseOn, IsSelected, IsPreview)
  83.     'End Function
  84.  
  85.     'Function OnAfterDraw(IsMouseOn, IsSelected, IsPreview)
  86.     'End Function
  87.     
  88.     Sub OnSave()
  89.         Preferences.SaveAll 
  90.     End Sub
  91.  
  92.     'Optional. Indicates a preference change
  93.     Function OnPreferenceChange(Preference, oldValue, newValue)
  94.     Reset()
  95.     PrefChange = true
  96.     End Function
  97.  
  98.     Sub Reset()
  99.     Evaluate()
  100.     Desklet.move InitialLeft, InitialTop
  101.     state = 1
  102.     Ticker.Interval = TickRate
  103.     Ticker.Enabled = true
  104.     End Sub
  105.  
  106.     Sub Evaluate()
  107.     if EntranceSide = 8 Then
  108.         mySide = cint(Rnd()*7)
  109.     Else
  110.         mySide = EntranceSide
  111.     End If
  112.  
  113.     Select Case mySide
  114.     Case 0    ' Right side
  115.         InitialTop  = FinalTop
  116.         InitialLeft = screen_width
  117.     Case 1    ' Bottom side
  118.         InitialTop  = screen_height
  119.         InitialLeft = FinalLeft
  120.     Case 2    ' Left side
  121.         InitialTop  = FinalTop
  122.         InitialLeft = - Desklet.Width
  123.     Case 3    ' Top side
  124.         InitialTop  = - Desklet.Height
  125.         InitialLeft = FinalLeft
  126.     Case 4    ' Top/Right corner
  127.         InitialTop  = - Desklet.Height
  128.         InitialLeft = Screen_Width
  129.     Case 5    ' Top/Left corner
  130.         InitialTop  = - Desklet.Height
  131.         InitialLeft = - Desklet.Width
  132.     Case 6    ' Bottom/Right corner
  133.         InitialTop  = Screen_Height
  134.         InitialLeft = Screen_Width
  135.     Case 7    ' Bottom/Left corner
  136.         InitialTop  = Screen_Height
  137.         InitialLeft = - Desklet.Width
  138.     Case Else
  139.         ' duh ?  aaargh !
  140.         Desklet.label = "MIIE: aaargh!"
  141.     End Select
  142.  
  143.     'tickrate in [50 + 0 .. 50 + 200]
  144.     TickRate = 50 + cint(200 * (100 - Smoothness) / 100)
  145.     Step = 11 - Speed
  146.  
  147.     PrefChange = false
  148.     End Sub
  149.  
  150.  
  151.  
  152.     'You can only have 1 Ticker per effectlet
  153.     'The OnTimer method is shielded against multiple entrance recursion
  154.     Sub OnTimer()
  155.     If State = 1 Then
  156.         If Desklet.left <> FinalLeft Then
  157.             HMov = cint((FinalLeft - Desklet.left)/abs(FinalLeft - Desklet.left)) + cint((FinalLeft - Desklet.left) / Step)
  158.         Else
  159.             HMov = 0
  160.         End If
  161.  
  162.         If Desklet.top <> FinalTop Then
  163.             VMov = cint((FinalTop - Desklet.top)/abs(FinalTop - Desklet.top)) + cint((FinalTop - Desklet.top) / Step)
  164.         Else
  165.             VMov = 0
  166.         End If
  167.     End If
  168.  
  169.     If (HMov <> 0) Or (VMov <> 0) Then
  170.         Desklet.Move Desklet.Left + HMov, Desklet.Top + VMov
  171.     Else
  172.         Desklet.Move FinalLeft, FinalTop
  173.         State = 0
  174.         Ticker.Enabled = false
  175.     End If
  176.  
  177.     'Desklet.Redraw()
  178.     End Sub
  179.  
  180.  
  181.     'Optional calls that we don't need for this script:
  182.  
  183.     'Sub OnSelect()   
  184.     'End Sub
  185.  
  186.     'Sub OnDeselect()   
  187.     'End Sub
  188.  
  189.     'Sub OnShow()         
  190.     'End Sub
  191.  
  192.     'Sub OnHide()         
  193.     'End Sub
  194.  
  195.     'Sub OnConfigure() 
  196.         'the configuration dialog with default UI for
  197.         'XML preferences will be shown.
  198.         'An additional dialog designer is on its way. It will
  199.         'extend the available default preferences of type:
  200.         ' - slider, checkbox, combobox (builtin, v. 1.1, free on form with v. 1.2)
  201.         ' - textbox, file browser, favorites URL (builtin and free on form, v. 1.2)
  202.         ' - Any ocx (external, only free on form, v. 1.2)
  203.     'End Sub
  204.  
  205.     Sub OnStartMove()
  206.     Ticker.Enabled = false
  207.     Desklet.move FinalLeft, FinalTop
  208.     End Sub
  209.  
  210.     Sub OnEndMove()
  211.     FinalTop = Desklet.top
  212.     FinalLeft = Desklet.left
  213.     Reset()
  214.     End Sub
  215.  
  216.     'Sub OnLeftClick()  
  217.     'End Sub
  218.  
  219.     'Sub OnRightClick()
  220.     'End Sub
  221.  
  222.     'Sub OnDestroy
  223.     'End Sub
  224.  
  225.  
  226.     ]]></script>
  227. </effectlet>
  228.